﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlphaSolutionsGP.Demo_classes
{
    class QualificationDemo
    {
        private Qualification q1;
        private Qualification q2;
        private Qualification q3;
        private string passorfail;
        private int _pass;
        private int _fail;

        public QualificationDemo()
        {
            if ((testQualificationNoArgConstructor()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testQualificationArgConstructor() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testCreateQualification() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testGetters() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testAmmendQualification() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testDeleteQualification() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
        }

        bool testQualificationNoArgConstructor()
        {
            bool success = false;
            try
            {
                q1 = new Qualification();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testQualificationArgConstructor()
        {
            bool success = false;
            try
            {
                q2 = new Qualification(16,"GCSE","Computing","computer science","A","1998-01-10");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testGetters()
        {
            bool success = false;
            try
            {
                string type = q2.Type;
                string grade = q2.Grade;
                string subject = q2.Subject;
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCreateQualification()
        {
            bool success = false;
            try
            {
                q2.createQualification("20010426");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testAmmendQualification()
        {
            bool success = false;
            try
            {
                q2.Type = "ammend";
                q2.amendQualification();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testDeleteQualification()
        {
            bool success = false;
            try
            {
                q2.removeQualification();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCopy()
        {
            bool success = false;
            try
            {
                q3 = new Qualification(16, "GCSE", "Computing", "computer science", "A", "1998-01-10");
                q1.copyQualification(q3);
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        public int Fail
        {
            get { return _fail; }
            set { _fail = value; }
        }

        public int Pass
        {
            get { return _pass; }
            set { _pass = value; }
        }
    }


    
}
